package com.mowh.multithreading.active.object.active.active.object;

/**
 * @author mowh1gd
 * @create 2023/11/28 15:59
 */
public class ActiveObjectFactory {//返回一个代理Proxy实例，不是Servant实例。可使用单例模式或享元模式。
    public static ActiveObject createActiveObject() {
        Servant servant = new Servant();
        ActivationQueue queue = new ActivationQueue();
        SchedulerThread scheduler = new SchedulerThread(queue);
        Proxy proxy = new Proxy(scheduler, servant);
        scheduler.start();
        return proxy;
    }
}
